<template>
	<view class="QS container pre-hover" hover-class="hover" @tap="_click">
		<block v-if="listItem.type == 'ad'">
			<image src="" mode="aspectFill" style="width: 100%;height: 600rpx;background-color: #F2F2F2;"></image>
		</block>
		<block v-else>
			<view class="image-box">
				<image 
				:src="listItem.img"
				 mode="aspectFill" 
				 class="image"
				 @load="imageLoaded"></image>
			</view>
			<view class="content">
				<text class="QS-text large color_000000 weight_500">{{listItem.name}}</text>
				<view class="flex_row_between_c margin-top-rpx_15">
					<view class="flex_row_none_c">
						<text class="QS-text large-36rpx price-weight" style="color: #F52F50;">￥600</text>
						<QS-P width="15rpx"></QS-P>
						<text class="QS-text mini-x color_BBBBBB">￥800</text>
					</view>
					<!-- <image src="/static/image/cart.png" mode="aspectFill" class="dyc-img-cart"></image> -->
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		props: {
			listItem: {
				type: [Object, String, Number, Array],
				default: () => {
					return {}
				}
			},
			type: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				imgShow: false
			}
		},
		methods: {
			_click() {
				
			},
			imageLoaded(e) {
				this.$emit('imgLoaded')
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		/* #ifndef APP-NVUE */
		width: 100%;
		display: flex;
		/* #endif */
		flex-direction: column;
		border-radius: 10rpx;
		overflow: hidden;
		// padding: 15rpx;
		background-color: #fff;
	}

	.list-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		width: 330rpx;
		margin-left: 12px;
		margin-right: 12px;
		margin-top: 12px;
		/* padding: 20px; */
		background-color: #fff;
		border-radius: 5px;
		flex-direction: column;
		border-radius: 20rpx;
		overflow: hidden;
	}

	.image-box {
		// position: relative;
		// width: 100%;
		width: 100%;
		position: relative;
		height: 0;
		padding-top: 100%;
	}

	.image {
		// border-top-left-radius: 10rpx;
		// border-top-right-radius: 10rpx;
		// width: 100%;
		position: absolute;
		top: 0;
		left: 0;
		height: 100%;
		width: 100%;
		border-top-left-radius: 10rpx;
		border-top-right-radius: 10rpx;
		transition: opacity .3s;
		background-color: #F2F2F2;
	}

	.image-box-text {
		position: absolute;
		left: 10rpx;
		bottom: 10rpx;
		font-size: 28rpx;
		color: white;
		padding: 10rpx;
		background-color: rgba(0, 0, 0, .6);
	}

	.content {
		padding: 18rpx 20rpx;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
	}

	.title-image {
		height: 40rpx;
		width: 40rpx;
		border-radius: 50%;
	}
</style>
